import axios from '@/libs/axios.js';
let jsonHeaders = { 'content-type': 'application/json;charset=UTF-8' };
import baseUrl from './index';

//查询角色
export const queryRole = (params) => {
    return axios({
        url: `${baseUrl}/self-study/expRole`,
        method: 'get',
        headers: jsonHeaders,
        params: params
    });
};

//删除角色
export const delRole = (Id) => {
    return axios({
        url: `${baseUrl}/self-study/expRole/${Id}`,
        method: 'delete',
        headers: jsonHeaders
    });
};
//创建角色
export const addRole = (params) => {
    return axios({
        url: `${baseUrl}/self-study/expRole`,
        method: 'post',
        headers: jsonHeaders,
        data: params
    });
};
//修改角色
export const modRole = (params, id) => {
    return axios({
        url: `${baseUrl}/self-study/expRole/${id}`,
        method: 'put',
        headers: jsonHeaders,
        data: params
    });
};

//查询角色人员
export const queryRoleMember = (id, params) => {
    return axios({
        url: `${baseUrl}/self-study/expRole/users/${id}`,
        method: 'get',
        headers: jsonHeaders,
        params: params
    });
};
//添加角色人员
export const addRoleMember = (id, data) => {
    return axios({
        url: `${baseUrl}/self-study/expRole/users/${id}`,
        method: 'post',
        headers: jsonHeaders,
        data: data
    });
};
//删除角色人员
export const delRoleMember = (data) => {
    return axios({
        url: `${baseUrl}/self-study/expRole/users`,
        method: 'delete',
        headers: jsonHeaders,
        data: data
    });
};
//查询角色技能树
export const queryRoleSkill = (id, params) => {
    return axios({
        url: `${baseUrl}/self-study/expRoleSkill/${id}`,
        method: 'get',
        headers: jsonHeaders,
        params: params
    });
};
//添加角色技能树
export const addRoleSkill = (id, data) => {
    return axios({
        url: `${baseUrl}/self-study/expRoleSkill/${id}`,
        method: 'post',
        headers: jsonHeaders,
        data: data
    });
};
//删除角色人员
export const delRoleSkill = (id, data) => {
    return axios({
        url: `${baseUrl}/self-study/expRoleSkill/removeRoleSkills/${id}`,
        method: 'delete',
        headers: jsonHeaders,
        data: data
    });
};
//删除角色人员
export const getStatisticRoles= () => {
    return axios({
        url: `${baseUrl}/self-study/expRole/statisticRoles`,
        method: 'get',
        headers: jsonHeaders,
    });
};
